/*
*************************************
* PocketGTT
*************************************
This file is part of PocketGTT.

PocketGTT is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

PocketGTT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with PocketGTT.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.0

Rectangle {
    id: mydel
    height: textGroup.height  + 20   //85
    width: parent.width

//    color: myWin.theme.preferred_list_background// "#4d4d4d60"
    color: "transparent"

    property int count: ListView.view.count
//    property int localIndex: index

    clip: true

    Item {
        id: textGroup
        height: sTitle.height
        width: parent.width - 50
        anchors.left: parent.left
        anchors.leftMargin: 8
        anchors.verticalCenter: parent.verticalCenter

        Text {
            id: sTitle
            text: model.modelData
            anchors.top: parent.top
            anchors.horizontalCenter: parent.horizontalCenter
            width: parent.width

            color: "white"

            font.pixelSize: myWin.theme.textSizeM  //26
            wrapMode: Text.Wrap
        }

    }


    Item {
        anchors.right: parent.right
        anchors.left: textGroup.right
        anchors.verticalCenter: textGroup.verticalCenter
        height: textGroup.height

        ListArrow {
            pressed: listMA.pressed
            pressedColor:  myWin.theme.green_background
        }

    }

//    Image {
//        id: btnImgInfoBack
//        fillMode: Image.PreserveAspectFit
//        height: (parent.height >= 80) ? 64 : parent.height * 0.4
//        anchors.right: parent.right
//        anchors.rightMargin: 8
//        anchors.verticalCenter: parent.verticalCenter
//        source: "qrc:ui/play.svg"
//    }

    Separator {
        anchors.top: parent.top
        anchors.horizontalCenter: parent.horizontalCenter
        height: (index===0) ? 0 : 1
        color: myWin.theme.green_background //"#76e000"
    }
    // find a way to remove to bottom separator for the last item!!!
    Separator {
        anchors.bottom: parent.bottom
        anchors.horizontalCenter: parent.horizontalCenter
        height: (index===(parent.count-1)) ? 0 : 1
        color: myWin.theme.green_background //"#76e000"
    }

    MouseArea {
        id: listMA
        anchors.fill: parent
        onClicked: {
//            console.log(mydel.localIndex);
//            console.log(index);
            GTT.selectedMultipleStops(index);
            GTT.SelectMultipleStopsStatus = 0; // GTTStopInfo.SelectMultipleStopsHidden;
        }
    }

}
